package 算法;

import java.util.*;

public class 独一无二的出现次数 {
    public static void main(String[] args) {
        Set<List> set = new HashSet();
        List list = new ArrayList();
        list.add(1);
        list.add(2);
        list.add(3);
        List list2 = new ArrayList();
        list2.add(1);
        list2.add(2);
        list2.add(3);
        set.add(list);
        set.add(list2);
        System.out.println(set.size());
    }
    //包含start,end
    public static int[] fenZ(int[] fen){
        int minin = 0;
        int minVale = minin;
        for (int i = 0; i < fen.length; i++) {
            minVale = fen[i];
            minin = i;
            for (int j = i+1; j < fen.length; j++){
                if(fen[j] < minVale){
                    minVale = fen[j];
                    minin = j;
                }
            }
            fen[minin] = fen[i];
            fen[i] = minVale;
        }
        return fen;

    }
    public int[] twoSum(int[] nums, int target) {
        //快速
        for (int i = 0; i < nums.length; i++) {
            for (int i1 = i+1; i1 < nums.length; i1++) {
                if(nums[i]+nums[i1] == target){
                    return new int[]{nums[i],nums[i1]};
                }
            }
        }
        return null;
    }
    public static boolean uniqueOccurrences(int[] arr) {
        Map<Integer,Integer> has = new HashMap<>();
        for (int i : arr) {
            int j = null == has.get(i) ?0:has.get(i);
            has.put(i,j+1);
        };
        Set<Integer> set = new HashSet<>();
        final int[] i = {0};
        has.values().forEach(e->{

            if(set.contains(has.get(e))){return ;};
            i[0]++;
            set.add(e);
        });

        if(i[0] == has.size()){
            return true;
        }
        return false;
    }
}

